<template>
  <div class="container">
    <div class="screen"
         ref="screen">
      <div class="top">
        <Header></Header>
      </div>
      <div class="bottom">
        <div class="left">
          <Tourist class="tourist"></Tourist>
          <Sex class="sex"></Sex>
          <Age class="age"></Age>
        </div>
        <div class="center">
          <Map class="map"></Map>
          <Line class="line"></Line>
        </div>
        <div class="right">3</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import Header from './Header/index.vue'
import Sex from './components/sex/index.vue'
import Age from './components/age/index.vue'
import Tourist from './components/tourist/index.vue'
import Map from './components/map/index.vue'
import Line from './components/line/index.vue'
import { onMounted, ref } from 'vue'
let screen = ref()
function getScale(w = 1920, h = 1080) {
  let ww = window.innerWidth / w
  let wh = window.innerHeight / h
  return ww < wh ? ww : wh
}
onMounted(() => {
  screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`
})
</script>
<style scoped lang="scss">
.container {
  width: 100vw;
  height: 100vh;
  background: url('./images/bg.png') no-repeat;
  background-size: cover;
  .screen {
    width: 1920px;
    height: 1080px;
    position: fixed;
    left: 50%;
    top: 50%;
    transform-origin: left top;
  }
  .bottom {
    display: flex;

    .right {
      flex: 1;
      display: flex;
      flex-direction: column;
      margin-left: 40px;

      .rank {
        flex: 1.5;
      }

      .year {
        flex: 1;
      }

      .count {
        flex: 1;
      }
    }

    .left {
      flex: 1;
      height: 1040px;
      display: flex;
      flex-direction: column;

      .tourist {
        flex: 1.2;
      }

      .sex {
        flex: 1;
      }

      .age {
        flex: 1;
      }
    }

    .center {
      flex: 1.5;
      display: flex;
      flex-direction: column;

      .map {
        flex: 4;
      }

      .line {
        flex: 1;
      }
    }
  }
}
</style>
